package com.fqgj.xjd.user.dao.impl;
import com.fqgj.common.base.AbstractBaseMapper;
import com.fqgj.xjd.user.dao.UserActivityReadDao;
import com.fqgj.xjd.user.entity.UserActivityReadEntity;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* User: frank
* Date: 2020-04-16
* Time: 12:06:09.288
*/

@Repository
public class UserActivityReadDaoImpl extends AbstractBaseMapper<UserActivityReadEntity> implements UserActivityReadDao {


    @Override
    public List<UserActivityReadEntity> getActivityReadByUserCodeAndType(String userCode, Integer type) {
        Map params = new HashMap();
        params.put("userCode",userCode);
        params.put("type",type);
        return getSqlSession().selectList(getStatement("getActivityReadByUserCodeAndType"),params);
    }

    @Override
    public UserActivityReadEntity getActivityReadByUserCodeAndActivityId(Long activityId, String userCode, Date currentDate) {
        Map params = new HashMap();
        params.put("userCode",userCode);
        params.put("activityId",activityId);
        params.put("currentDate",currentDate);
        return getSqlSession().selectOne(getStatement("getActivityReadByUserCodeAndActivityId"),params);
    }

    @Override
    public List<UserActivityReadEntity> getActivityReadByUserCode(String userCode) {
        Map params = new HashMap();
        params.put("userCode",userCode);
        return getSqlSession().selectList(getStatement("getActivityReadByUserCode"),params);
    }
}